<?php if (!defined('THINK_PATH')) exit();?><!doctype html>
<html>
<head>
	<meta charset="utf-8">
	<!-- Set render engine for 360 browser -->
	<meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- HTML5 shim for IE8 support of HTML5 elements -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <![endif]-->

	<link href="/public/simpleboot/themes/<?php echo C('SP_ADMIN_STYLE');?>/theme.min.css?1" rel="stylesheet">
    <link href="/public/simpleboot/css/simplebootadmin.css?8" rel="stylesheet">
    <link href="/public/js/artDialog/skins/default.css" rel="stylesheet" />
	<link href="/public/css/other.css?<?php echo time(); ?>" rel="stylesheet" />
    <link href="/public/simpleboot/font-awesome/4.4.0/css/font-awesome.min.css"  rel="stylesheet" type="text/css">
    <style>
		form .input-order{margin-bottom: 0px;padding:3px;width:40px;}
		.table-actions{margin-top: 5px; margin-bottom: 5px;padding:0px;}
		.table-list{margin-bottom: 0px;}
	</style>
	<!--[if IE 7]>
	<link rel="stylesheet" href="/public/simpleboot/font-awesome/4.4.0/css/font-awesome-ie7.min.css">
	<![endif]-->
	<script type="text/javascript">
	//全局变量
	var GV = {
	    ROOT: "/",
	    WEB_ROOT: "/",
	    JS_ROOT: "public/js/",
	    APP:'<?php echo (MODULE_NAME); ?>'/*当前应用名*/
	};
	</script>
    <script src="/public/js/jquery.js"></script>
    <script src="/public/js/jquery.quicksearch.js"></script>
    <script src="/public/js/wind.js"></script>
    <script src="/public/simpleboot/bootstrap/js/bootstrap.min.js"></script>
    <script>
    	$(function(){
    		$("[data-toggle='tooltip']").tooltip();
    	});
    </script>
<?php if(APP_DEBUG): ?><style>
		#think_page_trace_open{
			z-index:9999;
		}
	</style><?php endif; ?>
</head>
<body>
	<div class="wrap">
		<ul class="nav nav-tabs">
			<li><a href="<?php echo U('user/index');?>"><?php echo L('ADMIN_USER_INDEX');?></a></li>
            <li class="active"><a href="<?php echo U('user/add');?>"><?php echo L('ADMIN_USER_ADD');?></a></li>

		</ul>
		<form method="post" class="form-horizontal js-ajax-form" action="<?php echo U('User/add_post');?>">
			<fieldset>
				<div class="control-group">
					<label class="control-label"><?php echo L('USERNAME');?></label>
					<div class="controls">
						<input type="text" name="user_login">
					</div>
				</div>
				<div class="control-group">
					<label class="control-label"><?php echo L('PASSWORD');?></label>
					<div class="controls">
						<input type="password" name="user_pass">
					</div>
				</div>
                <div class="control-group">
                    <label class="control-label">姓名</label>
                    <div class="controls">
                        <input type="text" name="user_nicename">
                    </div>
                </div>
				<div class="control-group">
					<label class="control-label">手机号</label>
					<div class="controls">
						<input type="text" name="user_phone">
					</div>
				</div>
				<!--<div class="control-group">-->
					<!--<label class="control-label"><?php echo L('EMAIL');?></label>-->
					<!--<div class="controls">-->
						<!--<input type="text" name="user_email">-->
					<!--</div>-->
				<!--</div>-->
				<div class="control-group">
					<label class="control-label"><?php echo L('ROLE');?></label>
					<div class="controls">
						<?php if(is_array($roles)): foreach($roles as $key=>$vo): if($vo['id'] != 1 && $vo['id'] != 5): ?><label class="checkbox inline"><input value="<?php echo ($vo["id"]); ?>" onchange="change_role()" type="radio" name="role_id" <?php if(sp_get_current_admin_id() != 1 && $vo['id'] == 1): ?>disabled="true"<?php endif; ?>>&nbsp;&nbsp;<?php echo ($vo["name"]); ?>&nbsp;&nbsp;</label><?php endif; endforeach; endif; ?>
					</div>
				</div>
                <div class="control-group logistics_list" style="display: none;">
                    <label class="control-label">上级物流公司</label>
                    <div class="controls">
                        <select name="organize_id1">
                            <option value="">请选择</option>
                            <?php if(is_array($logistics_list)): foreach($logistics_list as $key=>$litem): ?><option value="<?php echo ($litem['id']); ?>"><?php echo ($litem["logistics_name"]); ?></option><?php endforeach; endif; ?>
                        </select>
                    </div>
                </div>
                <div class="control-group sale_list" style="display: none;">
                    <label class="control-label">消费机构</label>
                    <div class="controls">
                        <select name="organize_id2">
                            <option value="">请选择</option>
                            <?php if(is_array($sale_list)): foreach($sale_list as $key=>$sitem): ?><option value="<?php echo ($sitem['id']); ?>"><?php echo ($sitem["sale_name"]); ?></option><?php endforeach; endif; ?>
                        </select>
                    </div>
                </div>
				<div class="control-group sale_manager_list" style="display: none;">
					<label class="control-label">上级消费机构</label>
					<div class="controls">
						<select name="organize_id3">
							<option value="">请选择</option>
							<?php if(is_array($sale_manager_list)): foreach($sale_manager_list as $key=>$smitem): ?><option value="<?php echo ($smitem['id']); ?>"><?php echo ($smitem["sale_manage_name"]); ?></option><?php endforeach; endif; ?>
						</select>
					</div>
				</div>
				<div class="control-group logistics_sub_list" style="display: none;">
				    <label class="control-label">二级物流公司</label>
				    <div class="controls">
				        <select name="organize_id4">
				            <option value="">请选择</option>
				            <?php if(is_array($logistics_sub_list)): foreach($logistics_sub_list as $key=>$litem): ?><option value="<?php echo ($litem['id']); ?>"><?php echo ($litem["logistics_name"]); ?></option><?php endforeach; endif; ?>
				        </select>
				    </div>
				</div>
                
			</fieldset>
			<div class="form-actions">
				<input type="hidden" name="model" value=""/>
				<button type="submit" class="btn btn-primary js-ajax-submit"><?php echo L('ADD');?></button>
				<a class="btn" href="javascript:history.back(-1);"><?php echo L('BACK');?></a>
			</div>
		</form>
	</div>
	<script src="/public/js/common.js"></script>
<script>
	function change_role(){
		var role_id = $("input[name='role_id']:checked").val();
		console.log(role_id);
		if(role_id  == 3){	//消费机构
			$(".sale_list").show();
			$(".logistics_list").hide();
			$(".sale_manager_list").hide();
			$(".logistics_sub_list").hide();
		}else if(role_id == 2){	//物流公司
			$(".sale_list").hide();
			$(".sale_manager_list").hide();
			$(".logistics_list").show();
			$(".logistics_sub_list").hide();
		}else if(role_id == 6){	// 上级消费机构
			$(".sale_manager_list").show();
			$(".sale_list").hide();
			$(".logistics_list").hide();
			$(".logistics_sub_list").hide();
		}else if(role_id == 7){	// 上级物流公司
			$(".sale_manager_list").hide();
			$(".sale_list").hide();
			$(".logistics_list").hide();
			$(".logistics_sub_list").show();
		}else{	//管理员
			$(".sale_list").hide();
			$(".logistics_list").hide();
			$(".sale_manager_list").hide();
		}
		$("input[name='model']").val(role_id);
	}
</script>
</body>
</html>